﻿

using Idenmpotency;

namespace Microsoft.AspNetCore.Idenmpotency
{
    /*
    1.配置
        路由->幂等
        本地返回
        继续转发
        返回幂等路由
    */

    /// <summary>
    /// 接口：幂等性请求处理中间件
    /// </summary>
    public interface IAspIdenmptencyRequestHandler
    {
        /// <summary>
        /// 前置检查
        /// </summary>
        /// <param name="request"></param>
        /// <param name="token"></param>
        /// <returns></returns>
        public Task<bool> PreCheckHandlerAsync(IAspIdenmpotencyRequest request);

        /// <summary>
        /// 首次请求处理
        /// </summary>
        /// <param name="context"></param>
        /// <param name="next"></param>
        /// <returns></returns>
        public Task FirstRequestHandleAsync(IAspIdenmpotencyRequest request);

        /// <summary>
        /// 重复请求处理
        /// </summary>
        /// <param name="context"></param>
        /// <param name="next"></param>
        /// <returns></returns>
        public Task ReiteratedRequestHandleAsync(IAspIdenmpotencyRequest request);
    }


}
